package edu.xhu.id.feign;

import edu.xhu.api.id.IdClient;
import edu.xhu.model.common.dtos.ResponseResult;
import edu.xhu.id.service.BiliDistributedIdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(value = "网页端分布式id", tags = "网页端分布式id")
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/bili_distributed_id")
public class BiliDistributedIdController implements IdClient {

    private final BiliDistributedIdService biliDistributedIdService;

    @GetMapping("/segment")
    @ApiOperation("号段模式获取分布式id")
    @Override
    public ResponseResult<?> getSegmentDistributedId(@RequestParam String key) {
        return biliDistributedIdService.getSegmentDistributedId(key);
    }

    @GetMapping("/snowflake")
    @ApiOperation("雪花模式获取分布式id")
    @Override
    public ResponseResult<?> getSnowflakeDistributedId() {
        return biliDistributedIdService.getSnowflakeDistributedId();
    }
}
